home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
ai
/
prlg195b.lzh
/
EXPERT.LZH
/
PRODSYS
/
RULES.PRO
< prev
next >
Wrap
Text File
|
1987-06-20
|
3KB
|
92 lines
/* RULES.PRO
Note: Use RULEPD for PD PROLOG. This is for type FS and higher.
by Xavier Salazar. May 30th, 1987
- interchange files,
- can introduce new data, depending on the BASE,
- lists facts (conditions) for a given result,
(in case of altering data, this must be annotated first),
- data can be changed,
- the whole BASE can be kept in a diskette:
forgetting rules and updating from the actual base to another one,
forgetting the actual and reconsulting for the new file.
*/
menu:- cls,nl,
print('\n\t\t\tRULES.PRO'),print('\n\t\t\t---------'),
title(R),datum(S),
print('\n\n\t\t\tBASE: ',R,'\t\tDATA: ',S),
print('\n\n\t\tc. Charge a file,'),
print('\n\t\tr. Result from facts,'),
print('\n\t\tf. Facts for a given result,'),
print('\n\t\td. Data (WARNING!: be sure BASE has data:- routine),'),
print('\n\t\te. Erase introduced data,'),
print('\n\t\tl. List objects,'),
print('\n\t\tt. Title DATA wrong,'),
print('\n\t\ti. Interchange BASE,'),
print('\n\t\tk. Keep the BASE with annotated data,'),
print('\n\t\tx. eXit program,'),
print('\n\t\ts. Exit system.'),
print('\n\n\t\t\t\tWhich '),ratom(X),o(X).
o(c):- file_in,menu.
o(l):- listing(obj),listing(es),listing(datum),print('\n\t\t\t RET'),ratom(_),
menu.
o(r):- case(X),retract(case(X)),asserta(case(n)),track.
o(f):- case(X),retract(case(X)),asserta(case(y)),trail.
o(e):- retract(datum(_)),fail.
o(e):- asserta(datum(no)),menu.
o(t):- datum(no),datum(yes),!,retract(datum(no)),asserta(datum(yes)),menu.
o(t):- asserta(datum(no)),menu.
o(d):- data,menu.
o(i):- title(Z),forget(Z),retract(title(Z)),asserta(title(no_file)),
datum(no),!,file_in,menu.
o(i):- asserta(datum(no)),file_in,menu.
o(k):- cls,print('Program must be ERASED:forget(rules),'),
print('\nupdate(<file1>,<file2>),'),
print('forget(<file1>.'),print('\nwrite:listing. and retract all,'),
print('\nconsult(rules).'),title(Tit),halt.
o(x):- halt.
o(s):- exitsys.
title(no_file).
case(n).
datum(no).
file_in:- print('\nTitulo: '),ratom(Tit),
title(S),retract(title(S)),asserta(title(Tit)),
consultv(Tit).
indata:- print('Must be the data subroutine in the base\n'),!,data.
indata:- print('There is not the subroutine data:- RET'),ratom(_),menu.
track:-cls,obj(X),!,print('RESULTS: ',X),print('\n\n\t\tRET'),
ratom(_),erase,menu.
track:- print('\nNOT DEFINED...'),
print('\n\n\tRET'),ratom(_),erase,menu.
trail:- cls,print('Result designation '),ratom(X),obj(X),listing(asserted),
listing(denied),print('\n\n\t\tRET'),ratom(_),erase,menu.
trail:- print('\nNOT DEFINED...'),print('\n\n\tRET'),
ratom(_),erase,menu.
affirm(X):- asserted(X),!.
affirm(X):- case(Y),Y='y',!,not(denied(X)),record(X,yes).
affirm(X):- case(Y),Y='n',!,not(denied(X)),question(X).
deny(X):- case(Y),Y='y',denied(X).
deny(X):- case(Y),Y='n',denied(X),!.
deny(X):- case(Y),Y='y',!,not(asserted(X)),record(X,no).
deny(X):- case(Y),Y='n',!,not(asserted(X)),question(X).
question(X):- print(X,' ? '), ratom(Answer), record(X,Answer).
record(X,yes):- asserta(asserted(X)).
record(X,no):- asserta(denied(X)), fail.
erase:- retract(asserted(_)),fail.
erase:- retract(denied(_)),fail.
erase:- menu.
?-menu.